home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWbostream - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/bstream.h> // Construct an RWbostream, using cout's streambuf: RWbostream bstr(cout); DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn Class RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm specializes the abstract base class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm to store variables in binary format. The results can be restored by using its counterpart RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm. You can think of it as a binary veneer over an associated ssssttttrrrreeeeaaaammmmbbbbuuuuffff. Because the RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm retains no information about the state of its associated ssssttttrrrreeeeaaaammmmbbbbuuuuffff, its use can be freely exchanged with other users of the ssssttttrrrreeeeaaaammmmbbbbuuuuffff (such as oooossssttttrrrreeeeaaaammmm or ooooffffssssttttrrrreeeeaaaammmm). NNNNooootttteeee tttthhhhaaaatttt vvvvaaaarrrriiiiaaaabbbblllleeeessss sssshhhhoooouuuulllldddd nnnnooootttt bbbbeeee sssseeeeppppaaaarrrraaaatttteeeedddd wwwwiiiitttthhhh wwwwhhhhiiiitttteeee ssssppppaaaacccceeee. Such white space would be interpreted literally and would have to be read back in as a character string. RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm can be interrogated as to the stream state using member functions ggggoooooooodddd(((()))), bbbbaaaadddd(((()))), eeeeooooffff(((()))), eeeettttcccc. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None EEEExxxxaaaammmmpppplllleeee See RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm for an example of how the file "ddddaaaattttaaaa....ddddaaaatttt" might be read back in. #include <rw/bstream.h> #include <fstream.h> main(){ ofstream fstr("data.dat"); // Open an output file RWbostream bstr(fstr); // Construct an RWbostream from it int i = 5; float f = 22.1; double d = -0.05; bstr << i; // Store an int in binary bstr << f << d; // Store a float & double } PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss RWbostream(streambuf* s); Construct an RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm from the ssssttttrrrreeeeaaaammmmbbbbuuuuffff ssss. For DOS, the ssssttttrrrreeeeaaaammmmbbbbuuuuffff must have been opened in binary mode. PPPPaaaaggggeeee 1111 RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RWbostream(ostream& str); Construct an RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm from the ssssttttrrrreeeeaaaammmmbbbbuuuuffff associated with the output stream ssssttttrrrr. For DOS, the ssssttttrrrreeeeaaaammmmbbbbuuuuffff must have been opened in binary mode. This can be done by specifying iiiioooossss::::::::bbbbiiiinnnnaaaarrrryyyy as part of the second argument to the constructor for an ooooffffssssttttrrrreeeeaaaammmm. Using the example above, the line to create the ooooffffssssttttrrrreeeeaaaammmm would read, ooooffffssssttttrrrreeeeaaaammmm ffffssssttttrrrr((((""""ddddaaaattttaaaa....ddddaaaatttt"""",,,, iiiioooossss::::::::oooouuuutttt |||| iiiioooossss::::::::bbbbiiiinnnnaaaarrrryyyy))));;;; where the "||||" is the binary OOOORRRR operator. PPPPuuuubbbblllliiiicccc DDDDeeeessssttttrrrruuuuccccttttoooorrrr virtual ~RWvostream(); This virtual destructor allows specializing classes to deallocate any resources that they may have allocated. PPPPuuuubbbblllliiiicccc OOOOppppeeeerrrraaaattttoooorrrrssss virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(const char* s); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the character string starting at ssss to the output stream in binary. The character string is expected to be null terminated. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(const wchar_t* ws); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the wide character string starting at wwwwssss to the output stream in binary. The wide character string is expected to be null terminated. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(char c); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the cccchhhhaaaarrrr cccc to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(wchar_t wc); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the wide cccchhhhaaaarrrr wwwwcccc to the output stream in binary. PPPPaaaaggggeeee 2222 RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(unsigned char c); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr cccc to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(double d); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the ddddoooouuuubbbblllleeee dddd to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(float f); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the ffffllllooooaaaatttt ffff to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(int i); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the iiiinnnntttt iiii to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(unsigned int i); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt iiii to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(long l); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the lllloooonnnngggg llll to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(unsigned long l); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnngggg llll to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(short s); PPPPaaaaggggeeee 3333 RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the sssshhhhoooorrrrtttt ssss to the output stream in binary. virtual RWvostream& ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(unsigned short s); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt ssss to the output stream in binary. ooooppppeeeerrrraaaattttoooorrrr vvvvooooiiiidddd****(); Inherited via RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm from RRRRWWWWvvvviiiioooossss.... PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss virtual RWvostream& fffflllluuuusssshhhh(); Send the contents of the stream buffer to output immediately. virtual RWvostream& ppppuuuutttt(char c); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the cccchhhhaaaarrrr cccc to the output stream. virtual RWvostream& ppppuuuutttt(wchar_t wc); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the wide character wwwwcccc to the output stream. virtual RWvostream& ppppuuuutttt(unsigned char c); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr cccc to the output stream. virtual RWvostream& ppppuuuutttt(const char* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of cccchhhhaaaarrrrs starting at pppp to the output stream in binary. PPPPaaaaggggeeee 4444 RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvostream& ppppuuuutttt(const wchar_t* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of wide cccchhhhaaaarrrrs starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const unsigned char* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrrs starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const short* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of sssshhhhoooorrrrtttts starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const unsigned short* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttts starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const int* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of iiiinnnntttts starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const unsigned int* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttts starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const long* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of lllloooonnnnggggs starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const unsigned long* p, size_t N); PPPPaaaaggggeeee 5555 RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnnggggs starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const float* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of ffffllllooooaaaatttts starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuutttt(const double* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Store the vector of ddddoooouuuubbbblllleeees starting at pppp to the output stream in binary. virtual RWvostream& ppppuuuuttttSSSSttttrrrriiiinnnngggg(const char* p, size_t N); Redefined from class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm. Data is formatted as a string containing NNNN characters. virtual RWvostream& ppppuuuuttttSSSSttttrrrriiiinnnngggg(const char*s, size_t N); Store the character string, iiiinnnncccclllluuuuddddiiiinnnngggg eeeemmmmbbbbeeeeddddddddeeeedddd nnnnuuuullllllllssss, starting at s to the output string. PPPPaaaaggggeeee 6666